Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | import Link from 'next/link' export default function Search({ search, results, server }) { console.log(server) return ( <div className="max-w-4xl mx-auto p-2"> <h1>Results</h1> <dl className="md:flex space-x-2"> <dt className="font-semibold">Displaying search results for:</dt> <dd>{search}</dd> </dl> <ul> {results.map((e) => ( <li key={e.title} className="underline text-periwinkle"> <Link href={e.href}> <a>{e.title}</a> </Link> </li> ))} </ul> </div> ) } export async function getServerSideProps({ locale, params }) { const { search } = params const server = process.env.NODE_ENV === 'production' ? `https://${process.env.PROJECT}-${process.env.BRANCH}.${process.env.BASE_DOMAIN}` : 'http://localhost:3000' let results = [] try { results = await ( await fetch(`${server}/api/searchPages`, { method: 'POST', headers: { 'content-type': 'application/json', }, body: JSON.stringify(search), }) ).json() } catch (e) {} /* istanbul ignore next */ const langToggleLink = locale === 'en' ? '/fr/engagement' : '/engagement' /* Place-holder Meta Data Props */ const meta = { data_en: { title: 'Digital Dojo - Team Engagement', desc: 'English', author: '', keywords: '', }, data_fr: { title: "Dojo Numérique - Mobilisation d'équipe", desc: 'Français', author: '', keywords: '', }, } return { props: { locale, langToggleLink, meta, search, results, server }, } } |